package za.org.jcicada.comms;

import java.io.IOException;

import za.org.jcicada.comms.messages.CommsMessage;
import za.org.jcicada.katcp.Message;

public interface IKatcpSerializerStrategy {

    /**
     * Serialize a CommsMessage to a katcp message.
     *
     * @param msg  Message to serialize.
     * @return  katcp message.
     * @throws IOException  if serialization fails.
     */
    Message toKatcp(CommsMessage msg) throws IOException;
    
    /**
     * Deserialize a CommsMessage from a katcp message.
     *
     * @param msg  katcp message to deserialize.
     * @return  The CommsMessage.
     * @throws IOException  if deserialization fails.
     */
    CommsMessage fromKatcp(Message msg) throws IOException;
}
